package com.test.web.controller;

import com.test.web.entity.Course;
import com.test.web.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lhc
 * @Date 2021/10/8 10:06
 */
@RestController
@RequestMapping("/course")
public class CourseController {
    @Autowired
    private CourseMapper courseMapper;

    @GetMapping("/add")
    public List<Course> findAll() {
        for (int i = 0; i <= 9; i++) {
            Course course = new Course();
            course.setCname("course" + i);
            course.setUserId("user_" + i);
            course.setCstatus("stastus" + i);
            courseMapper.insert(course);
        }
        return courseMapper.selectAll();
    }
}